package com.foreknow.elm.service.impl;

import com.foreknow.elm.dao.FoodDao;
import com.foreknow.elm.dao.OrdersDao;
import com.foreknow.elm.dao.impl.FoodDaoImpl;
import com.foreknow.elm.dao.impl.OrdersDaoImpl;
import com.foreknow.elm.po.Food;
import com.foreknow.elm.po.Orders;
import com.foreknow.elm.service.OrdersService;
import com.foreknow.elm.util.DBUtil;

import java.util.ArrayList;
import java.util.List;

public class OrdersServiceImpl implements OrdersService {
    @Override
    public List<Orders> listOrdersByUserId(String userId) {
        List<Orders> list = new ArrayList<>();
        OrdersDao dao = new OrdersDaoImpl();
        try {
            DBUtil.getConnection();
            list = dao.listOrdersByUserId(userId);
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            DBUtil.close();
        }
        return list;
    }
}
